package com.pro.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.pro.dao.impl.BannerDaoImpl;
import com.pro.dao.impl.CompanyDaoImpl;
import com.pro.dao.impl.NewsDaoImpl;
import com.pro.dao.impl.ProductDaoImpl;
import com.pro.util.BaseServlet;

public class HomeServlet extends BaseServlet {
	
	BannerDaoImpl bDaoImpl = new BannerDaoImpl();
	CompanyDaoImpl cDaoImpl = new CompanyDaoImpl();
	NewsDaoImpl newDaoImpl= new NewsDaoImpl();
	ProductDaoImpl pDaoImpl= new ProductDaoImpl();
	
	public void home(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
		//会话作用域  轮播图
		HttpSession session=request.getSession();
		session.setAttribute("bList", bDaoImpl.bannerAll());
		//公司介绍
		session.setAttribute("company", cDaoImpl.companyDetail());
		//请求作用域  产品案例
		request.setAttribute("pList", pDaoImpl.productAll(100));
		//新闻案例
		request.setAttribute("newsList", newDaoImpl.newsAll(100));
		
		request.getRequestDispatcher("index.jsp").forward(request, response);
			}
		}

